import collections

class Stats:
	""" Stats class """

	metric = None
	start_date = None
	end_date = None
	generated_date = None
	days = None

	def __init__(self, metric, startdate, enddate, generateddate):
		self.metric = metric
		self.start_date = startdate
		self.end_date = enddate
		self.generated_date = generateddate
		self.days = dict()

	def set_days(self, result):
		temp = dict()
		for day in result['day']:
			temp.update({day['@date'] : day['@value']})

		self.days[self.metric] = collections.OrderedDict(sorted(temp.items()))

	def __str__(self):
		return 'Stats (%s, %s)' % (self.metric, self.days)


if __name__ == "__main__":
	stats = Stats()

	print stats
